﻿<!--
	Copyright (c) 2014 Varian Medical Systems, Inc.

	Permission is hereby granted, free of charge, to any person obtaining a copy 
	of this software and associated documentation files (the "Software"), to deal 
	in the Software without restriction, including without limitation the rights 
	to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
	copies of the Software, and to permit persons to whom the Software is 
	furnished to do so, subject to the following conditions:

	 The above copyright notice and this permission notice shall be included in 
	 all copies or substantial portions of the Software.

	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
	THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
	THE SOFTWARE.
-->

<!-- 
This resource dictionary is used by the MainWindow. 
-->
<ResourceDictionary
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:vm="clr-namespace:DemoApp.ViewModel"
  xmlns:vw="clr-namespace:DemoApp.View"
  >

  <!-- 
  This template applies a PatientsView to an instance  
  of the PatientsrViewModel class shown in the main window.
  -->
  <DataTemplate DataType="{x:Type vm:PatientsViewModel}">
    <vw:PatientsView />
  </DataTemplate>
    <!-- 
  This template applies a SitesView to an instance  
  of the SitesViewModel class shown in the main window.
  -->
    <DataTemplate DataType="{x:Type vm:SitesViewModel}">
        <vw:SitesView />
    </DataTemplate>
    <!-- 
  This template applies a VolumesView to an instance  
  of the VolumesViewModel class shown in the main window.
  -->
    <DataTemplate DataType="{x:Type vm:VolumesViewModel}">
        <vw:VolumesView />
    </DataTemplate>

    <!-- 
  This template applies a SelectedPatientsView to an instance  
  of the SelectedPatientsViewModel class shown in the main window.
  -->
    <DataTemplate DataType="{x:Type vm:SelectedPatientsViewModel}">
        <vw:SelectedPatientsView />
    </DataTemplate>


    <!-- 
  This style configures both of the main content areas in the main window.
  -->
  <Style x:Key="MainHCCStyle" TargetType="{x:Type HeaderedContentControl}">
    <Setter Property="HeaderTemplate">
      <Setter.Value>
        <DataTemplate>
          <Border 
            Background="{StaticResource Brush_HeaderBackground}" 
            BorderBrush="LightGray" 
            BorderThickness="1" 
            CornerRadius="5" 
            Margin="4" 
            Padding="4" 
            SnapsToDevicePixels="True" 
            >
            <TextBlock 
              FontSize="14"
              FontWeight="Bold"
              Foreground="White" 
              HorizontalAlignment="Center"  
              Text="{TemplateBinding Content}" 
              />
          </Border>
        </DataTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="IsTabStop" Value="False" />
    <Setter Property="Template">
      <Setter.Value>
        <!-- 
        This template ensures that content of a HeaderedContentControl 
        fills the available vertical space. 
        -->
        <ControlTemplate TargetType="{x:Type HeaderedContentControl}">
          <DockPanel>
            <ContentPresenter 
              DockPanel.Dock="Top"
              ContentSource="Header" 
              ContentTemplate="{TemplateBinding HeaderTemplate}" 
              />
            <ContentPresenter 
              ContentSource="Content" 
              ContentTemplate="{TemplateBinding ContentTemplate}" 
              />
          </DockPanel>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!--
  This style ensures that the borders in the main window are consistent.
  -->
  <Style x:Key="MainBorderStyle" TargetType="{x:Type Border}">
    <Setter Property="Background" Value="WhiteSmoke" />
    <Setter Property="BorderBrush" Value="LightGray" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="CornerRadius" Value="5" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>

  <!--
  This template explains how to render the list of commands on the left
  side in the main window (the 'Control Panel' area).
  -->
  <DataTemplate x:Key="CommandsTemplate">
    <ItemsControl IsTabStop="False" ItemsSource="{Binding}" Margin="6,2">
      <ItemsControl.ItemTemplate>
        <DataTemplate>
          <TextBlock Margin="2,6">
            <Hyperlink Command="{Binding Path=Command}">
              <TextBlock Text="{Binding Path=DisplayName}" />
            </Hyperlink>
          </TextBlock>
        </DataTemplate>
      </ItemsControl.ItemTemplate>
    </ItemsControl>
  </DataTemplate>

  <!-- 
  This template explains how to render 
  a tab item with a close button.
  -->
  <DataTemplate x:Key="ClosableTabItemTemplate">
    <DockPanel Width="120">
      <Button 
        Command="{Binding Path=CloseCommand}"
        Content="X"
        Cursor="Hand"
        DockPanel.Dock="Right"
        Focusable="False"
        FontFamily="Courier" 
        FontSize="9"
        FontWeight="Bold"  
        Margin="0,1,0,0"
        Padding="0"
        VerticalContentAlignment="Bottom"
        Width="16" Height="16" 
        />
      <ContentPresenter 
        Content="{Binding Path=DisplayName}" 
        VerticalAlignment="Center" 
        />
    </DockPanel>
  </DataTemplate>

  <!--
  This template explains how to render the 'Workspace' content area in the main window.
  -->
  <DataTemplate x:Key="WorkspacesTemplate">
    <TabControl 
      IsSynchronizedWithCurrentItem="True" 
      ItemsSource="{Binding}" 
      ItemTemplate="{StaticResource ClosableTabItemTemplate}"
      Margin="4"
      />
  </DataTemplate>

</ResourceDictionary>